using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RevertPlayerSwapResolver : FieldEngine.MonoResolver
{
  public override void Resolve(IResolveEngine<FieldModel>.ResolveContext context) {
    bool hasRevert = false;
    var matchContext = context.Model.matchResolveContext;
    var grid = context.Model.gridModel;
    foreach (var swap in matchContext.PopCachedSwap())
    {
      grid.SwapBall(swap.pos0, swap.pos1);
      hasRevert = true;
    }
    if (hasRevert)
    {
      context.pushRegisteredHolder(FieldView.HOLDER_KEY);
    }
  }
}
